<template>
    <div class="box">
        <h1>{{isEdit?'添加':'编辑'}} </h1>
        <slot></slot>
        <div>
            <button @click="handle">{{isEdit?'添加':'修改'}}</button>
            <button @click="$emit('update:showDialog',false)">取消</button>
        </div>
    </div>
</template>

<script>
export default {
  name: 'DialogBook',
  props: {
    showDialog: {
      type: Boolean,
      default: false
    },
    isEdit: {
      type: Boolean,
      default: false
    }
  },
  data () {
    return {

    }
  },

  mounted () {

  },

  methods: {
    handle () {
      this.$emit('update')
    }

  }
}
</script>

<style scoped>
*{
    margin: 0;
    padding: 0;
}
.box {
    width: 400px;
    height: 400px;
    background-color: skyblue;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
}
</style>
